<?php
$colname_order_by_id = "-1";
if (isset($_GET['order_id'])) {
  $colname_order_by_id = $_GET['order_id'];
}
mysql_select_db($database_drycleaners_conn, $drycleaners_conn);
$query_order_by_id = sprintf("SELECT person.first_name,
       person.last_name,
       `order`.created_date,
       `order`.id,
       branch.name,
       `order`.order_no
  FROM    (   (   drycleaners.`order` `order`
               INNER JOIN
                  drycleaners.branch branch
               ON (`order`.branch_id = branch.id))
           INNER JOIN
              drycleaners.customer customer
           ON (`order`.customer_id = customer.id))
       INNER JOIN
          drycleaners.person person
       ON (customer.person_id = person.id)
	   
		  WHERE order.branch_id='".$_SESSION['branch_id']."'
		  AND order.id = %s", GetSQLValueString($colname_order_by_id, "int"));
$order_by_id = mysql_query($query_order_by_id, $drycleaners_conn) or die(mysql_error());
$row_order_by_id = mysql_fetch_assoc($order_by_id);
$totalRows_order_by_id = mysql_num_rows($order_by_id);
 get_main_menu("receptionist") ?>
<?php
mysql_select_db($database_drycleaners_conn, $drycleaners_conn);
$query_get_order_item = "
SELECT type_of_service.name type_of_service,
       item.name as item,
       material.name as material,
       order_item.color,
	   order_item.id,
       order_item.tag
  FROM    (   (   drycleaners.order_item order_item
               INNER JOIN
                  drycleaners.type_of_service type_of_service
               ON (order_item.type_of_service_id = type_of_service.id))
           INNER JOIN
              drycleaners.item item
           ON (order_item.item_id = item.id))
       INNER JOIN
          drycleaners.material material
       ON (order_item.material_id = material.id)
Where order_item.order_id='".$_REQUEST['order_id']."'
";
$get_order_item = mysql_query($query_get_order_item, $drycleaners_conn) or die(mysql_error());
$row_get_order_item = mysql_fetch_assoc($get_order_item);
$totalRows_get_order_item = mysql_num_rows($get_order_item);
?>
<?php include"includes/table_settings.php"?>
  <div>
  <a href=".?<?php echo $_REQUEST['back_page']?>"><img src="images/back-button.png" width="30" height="30" title="Back" /></a>&nbsp;&nbsp;<a href=".?<?php get_child_link("0000-00-00 00:00:00","suborder_view","suborder_view");?>= true&amp;order_id=<?php echo $_REQUEST['order_id']; ?>&back_page=order_item_view&amp;order_id=<?php echo $_REQUEST['order_id']; ?>"><input name="" value="Transfer" type="submit" id="edit_forms"/></a></div> 
  
  <div class="module_title"><strong>Items For Order No:</strong><?php echo $row_order_by_id['order_no'] ?>&nbsp;&nbsp;Of &nbsp; <strong>Customer Names:</strong><?php echo $row_order_by_id['first_name']." ".$row_order_by_id['last_name'] ?>
  </div> 
            	<table cellpadding="0" cellspacing="0" border="0" id="dataTable">
                <thead>
                  <tr>
                    <th>Id</th>
                    <th>Item</th>
                    <th>Material</th>
                    <th>Color</th>
                    <th>Type Of Service</th>
                    <th>Services</th>
                  </tr>
                </thead>
                <tbody>
                 <!--Loop start, you could use a repeat region here-->
  <?php do{?>
    <!--Loop start, you could use a repeat region here-->
   <?php		
	  $get_order_item_service = mysql_query("SELECT service.name
  		FROM    drycleaners.order_item_service order_item_service
       INNER JOIN
          drycleaners.service service
       ON (order_item_service.service_id = service.id)
	   WHERE order_item_id='".$row_get_order_item['id']."'
	   ") or die(mysql_error());
	   $row_get_order_item_service = mysql_fetch_assoc($get_order_item_service);
	   ?>
    
    <tr>
      <td><?php echo $row_get_order_item['id']?></td>
      <td><?php echo $row_get_order_item['item']?></td>
      <td><?php echo $row_get_order_item['material']?></td>
      <td><?php echo $row_get_order_item['color']?></td>
      <td><?php echo $row_get_order_item['type_of_service']?></td>
      <td>
       <?php
	    do{ echo $row_get_order_item_service['name']." &nbsp;&nbsp;";}while($row_get_order_item_service=mysql_fetch_assoc($get_order_item_service)); ?></td>
    </tr>
    <?php }while($row_get_order_item=mysql_fetch_assoc($get_order_item));?>
                  <!--Loop end-->
                </tbody>
              </table>
        	</div>
<div class="tab_column" id="form_area">
          </div>         
     	</div>     
</div>
<?php
mysql_free_result($get_order_item);

mysql_free_result($order_by_id);
?>